/**
 *
 */
package de.cbf.cam.dsa.services.impl.rcp_provider.factorys;

import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;

import de.cbf.cam.dsa.services.impl.rcp_provider.ProviderCulture;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.RCPServiceImplExtensionPointResovler;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.interfaces.IRCPPersisterCulture;
import de.cbf.cam.dsa.services.interfaces.rcp_provider.IServiceDSAProviderCulture;

/**
 * @author salter
 *
 */
public class ServiceFactoryProviderCultureDSA implements ServiceFactory<IServiceDSAProviderCulture> {

	@Override
	public IServiceDSAProviderCulture getService(Bundle bundle,
			ServiceRegistration<IServiceDSAProviderCulture> registration) {
		return getService();
	}

	@Override
	public void ungetService(Bundle bundle,
			ServiceRegistration<IServiceDSAProviderCulture> registration,
			IServiceDSAProviderCulture service) {

	}

	public IServiceDSAProviderCulture getService() {
		ProviderCulture provider = new ProviderCulture();
		IRCPPersisterCulture persister = RCPServiceImplExtensionPointResovler.getInstance().getPreferredCulturePersister();
		provider.setPersister(persister);
		return provider;
	}
}
